home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvg110a.zip / TVGRAPH.DOC < prev    next >
Text File  |  1993-06-23  |  7KB  |  189 lines

  1.                               TVGRAPH 1.10
  2.                               TURBO VISION
  3.                   using TURBO VISION In EGA/VGA graphics
  4.                            (C) Mindware 1991,1993
  5.                          Brisbane,QLD,Australia
  6.                            Fido : 3:640/307
  7.  
  8. 0. See Modified TVDEMO program and STYX.PAS to show you how to do things
  9. To recompile the TVDEMO program, copy TVDEMO.PAS and STYX.PAS to the
  10. TVDEMO directory, then build TVDEMO. Ensure all standard units are the
  11. original (i.e. time stamp is 7.0x) or version mismatches will occur.
  12.  
  13. 1. All that is required is to include TVGRAPH in the uses statement in your
  14. main program and amazing - TV will work in graphics mode.
  15.  
  16. 2. Declarations are as follows
  17.  
  18. type
  19.  PGRect=^GRect;
  20.  GRect=Trect;
  21.  
  22.  PGPoint=^GPoint;
  23.  GPoint=TPoint;    (* These two just to avoid confusion *)
  24.  
  25. 3. Graphics IDs
  26. All "text" windows are given a graphics ID of 0, each window you want
  27. to use graphics in - you need to assign a graphics ID to it, if a line is
  28. drawn using the internal RawDrawLine - then if the current graphics window
  29. is the same as the location you are writing to on the screen then the graphics
  30. will overwrite - else the graphics will be clipped.
  31.  
  32. function NextGraphId:byte; (* Get next available graphics id *)
  33. procedure UseGraphId(b:byte); (* Use graphics ID for following graphics *)
  34. procedure ReleaseGraphId(b:byte); (* release graphics ID for use *)
  35.  
  36. To assign a graphics id to a character cell ensure you write character n with
  37. attribute 0FFh into the location using standard TURBO VISION methods.
  38.  
  39.  
  40. 4. Working with BGI
  41. You can use BGI routines without initialising, TVgraph has already done that.
  42. Warning TVision will overwrite BGI graphics and vice-versa.
  43.  
  44. 5. Interface Sections :
  45. --------------------------- TVGRAPH ---------------------------------------
  46. const
  47.   cmTvGraphDraw = 1991;  (* Send this to a TVGView to draw the view *)
  48.   cmTvGraphProd = 1992;  (* Send this to a TVGView to prod the view *)
  49.  
  50. type
  51.   PTVGApp = ^TVGApp;
  52.   TVGApp = object(TProgram)
  53.     constructor Init;
  54.     destructor Done; virtual;
  55.     procedure SetScreenMode(Mode: Word);
  56. {$IFDEF Ver70}
  57.     procedure Cascade;
  58.     procedure DosShell;
  59.     procedure GetTileRect(var R: TRect); virtual;
  60.     procedure HandleEvent(var Event: TEvent); virtual;
  61.     procedure Tile;
  62.     procedure WriteShellMsg; virtual;
  63. {$ENDIF}
  64.   end;
  65.  
  66.   PTVGView = ^TVGView;
  67.   TVGView = object(TView)
  68.     GraphWindowId:byte;
  69.     constructor Init(Var Bounds:Trect);
  70.     destructor Done;virtual;
  71.     procedure Prod; virtual;
  72.     procedure GraphDraw; virtual;
  73.     procedure Draw; virtual;
  74.     procedure GetGraphBounds(var R:GRect);
  75.     procedure GetGraphClipRect(var R:GRect);
  76.     procedure HandleEvent(var Event:TEvent); virtual;
  77.   end;
  78.  
  79.   PTVGWindow = ^TVGWindow;
  80.   TVGWindow = object(TWindow)
  81.     constructor Init(var Bounds: TRect; ATitle: TTitleStr; ANumber: Integer);
  82.   end;
  83.  
  84. --------------------------- TVGDEFS ---------------------------------------
  85. {$IFDEF Ver60}
  86. const
  87.   Seg0040=$0040;
  88.   SegA000=$A000;
  89. {$ENDIF}
  90.  
  91. const
  92.   GraphXMax=10000;
  93.   GraphYMax=07500;
  94.   smEGA = $1010;
  95.   smVGA = $1012;
  96.   smGraphAutoDetect=$10FF;   (* Autodetect *)
  97.   wrmOVERWRITE = 0;
  98.   wrmAND = 1;
  99.   wrmOR = 2;
  100.   wrmXOR = 3;
  101.  
  102. const
  103.   BGIPath:string='';
  104.   CurrentGraphWindow:byte=1;
  105.   CurrentLineStyle:word=$FFFF;
  106.                         (* Current Line style in 1=line 0=no line       *)
  107.   CurrentLineWriteMode:byte=$00;
  108.                         (* Current Write mode for lines                 *)
  109.   TVgraphCheckSnow:byte=101;
  110.                         (* Set Checksnow to this to start the graphics  *)
  111.                         (* Version of REP STO                           *)
  112. type
  113.   PGRect=^GRect;
  114.   GRect=Trect;
  115.  
  116.   PGPoint=^GPoint;
  117.   GPoint=TPoint;
  118.  
  119. var
  120.   CharWidth,CharHeight:byte;
  121.                         (* Width and Height in text mode                *)
  122.   GraphWidth,GraphHeight:word;
  123.                         (* Width and height in graphics                 *)
  124.   TvGraphLoc,TvGraphCursor:word;
  125.                         (* Store current text x,y and top/bottom cursor *)
  126.   GraphMouseLoc:TPoint; (* Graphics location of Mouse *)
  127.   TVGraphVideoMode:word;
  128.   BytesPerLine:word;    (* Bytes per line in graphics mode              *)
  129.   SaveJump:word;        (* Save jump location for GraphMov              *)
  130.   FontTable:ABitFont;   (* In Memory font table                         *)
  131.   PtrFontTable:PABitFont;(* Pointer to In Memory font table             *)
  132.   GraphWriteAvail:array[0..4095] of byte;
  133.   (* one byte for each text position on the screen, 0=text screen and   *)
  134.   (* a number 1-254 representing distinct graphics windows and 255      *)
  135.   (* represents the mouse cursor positions                              *)
  136.   GraphIdSet:set of byte;
  137.   VideoBufferSeg:word;  (* Video Segment for display *)
  138.  
  139. procedure GlobalToPhysical(Var X,Y:integer);
  140. procedure PhysicalToGlobal(Var P:GPoint);
  141. procedure TextToGraphics(T:TRect;var G:GRect);
  142.  
  143. function NextGraphId:byte;
  144. procedure UseGraphId(b:byte);
  145. procedure ReleaseGraphId(b:byte);
  146. function GraphIdAt(X,Y:integer):byte;
  147.  
  148. procedure MouseCursorOff;
  149. procedure MouseCursorOn;
  150. procedure ResetMouse;
  151.  
  152. --------------------------- TVGWHIZ ---------------------------------------
  153. procedure DrawLine(X1,Y1,X2,Y2:integer;Color:word);
  154. procedure RawDrawLine(X1,Y1,X2,Y2:integer;Color:word);
  155.  
  156. ---------------------------------------------------------------------------
  157.  
  158. TVGDEMEX.ZIP
  159.  
  160.  168752  TVDEMO.EXE             Compiled demo in real mode TP7/BP7
  161.  
  162. T6DEMSRC.ZIP
  163.  
  164.    3553  STYX.PAS               STYX.PAS for Turbo 6 TVDEMO
  165.   18013  TVDEMO.PAS             TVDEMO.PAS modified Turbo 6 Turbo Vision
  166.  
  167. T6DEMBIN.ZIP
  168.  
  169.    4256  TVGDEFS.TPU            ] Demo
  170.    5760  TVGDRIVE.TPU           ] Units
  171.   10928  TVGRAPH.TPU            ] Compiled
  172.    4000  TVGWHIZ.TPU            ] For TP6
  173.  
  174. B7DEMBIN.ZIP
  175.  
  176.    3728  TVGDEFS.TPU            ] Demo
  177.    3616  TVGDRIVE.TPU           ] Units
  178.    9056  TVGRAPH.TPU            ] Compiled
  179.    2336  TVGWHIZ.TPU            ] For TP7 real mode
  180.    3728  TVGDEFS.TPP            ] Demo
  181.    3616  TVGDRIVE.TPP           ] Units
  182.    9168  TVGRAPH.TPP            ] Compiled
  183.    2352  TVGWHIZ.TPP            ] For BP7 protected mode
  184.  
  185. B7DEMSRC.ZIP
  186.  
  187.   19714  TVDEMO.PAS             TVDEMO.PAS modified TP7/BP7 Turbo Vision
  188.    3548  STYX.PAS               STYX.PAS for Turbo 7/BP 7 TVDEMO
  189.